﻿Public Class Epixirisi

    Private idEt As String
    Private _flagNew As Boolean
    Public Property flagNew() As Boolean
        Get
            Return _flagNew
        End Get
        Set(ByVal value As Boolean)
            _flagNew = value
        End Set
    End Property

    Public Sub New(ByVal flag As Boolean)
        InitializeComponent()
        Me.flagNew = flag
    End Sub


    Private Sub EtairiaBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EtairiaBindingNavigatorSaveItem.Click
        Try
            Me.Validate()
            Me.EtairiaBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.PanalogDataSet)
        Catch ex As NoNullAllowedException
            MsgBox("Πρέπει να συμπληρώσεις όλα τα πεδία")
            Return
        End Try
    End Sub

    Private Sub Epixirisi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'PanalogDataSet.Efories' table. You can move, or remove it, as needed.
        Me.EforiesTableAdapter.Fill(Me.PanalogDataSet.Efories)
        Me.EtairiaTableAdapter.FillEtairia(Me.PanalogDataSet.Etairia, idEt)
        If (flagNew) Then
            Me.BindingNavigatorAddNewItem.PerformClick()
            flagNew = False
        End If
    End Sub
    Public Sub gemisma(ByRef id)
        idEt = id
    End Sub

    Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
        If Not (My.Computer.Keyboard.NumLock) And My.Computer.Keyboard.CapsLock Then
            MsgBox("Προσοχή το Num Lock είναι απενεργοποιημένο και το Caps Lock ενεργοποιημένο.")
        ElseIf Not My.Computer.Keyboard.NumLock Then
            MsgBox("Προσοχή το Num Lock είναι απενεργοποιημένο.")
        ElseIf My.Computer.Keyboard.CapsLock Then
            MsgBox("Προσοχή το Caps Lock είναι ενεργοποιημένο.")
        End If
    End Sub

End Class